package CartService

import (
	"context"
	toolsDb "gdshop-back-end-go/common/db"
	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/util/gconv"
)

func BaseCount(ctx context.Context, memberId int) int {
	count, err := toolsDb.GetUnSafaTableAddDeleteWhere(
		ctx,
		"member_cart").Fields("1").Where(
		"member_id=?",
		memberId,
	).Count()
	if err != nil {
		g.Log().Async().Error("GetCount 查询报错 memberId " + gconv.String(memberId))
		return 0
	} else {
		return count
	}
}
